package com.ssd.utils;


/**
 * Token上下文，用于远程调用
 */
public class TokenContext {

    private static final ThreadLocal<String> THREAD_LOCAL_TOKEN=new ThreadLocal<>();


    /**
     * 获取当前token
     * @return
     */
    public static String currentToken() {
        return THREAD_LOCAL_TOKEN.get();
    }

    /**
     * 设置当前token
     * @param token
     */
    public static void set(String token) {
    	THREAD_LOCAL_TOKEN.set(token);
    }

    /**
     * 清除当前线程的token
     */
    public static void clear(){
        THREAD_LOCAL_TOKEN.remove();
    }


}
